

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en">
<head>
    <meta http-equiv="Content-Type" content="text/html;charset=UTF-8" />
    <title>注册</title>
    <link href="<?php echo CON_STATIC_URL; ?>zhsjr/css/reg/reg.css" rel="stylesheet" type="text/css" />
</head>
<body>
    <!--头部-->
    <?php include './application/views/common/zhs_header.php';?>
    <div class="mainNav">
        <div class="mainNav_inner clearfix w1000center">
            <div class="loginTxt">免费注册</div>
            <div class="acguanlian"><a href="/user/zhs_center.html" title="已有账号？立即登录">已有账号，马上登陆</a></div>
        </div>
    </div>
    <!--头部结束-->

    <div class="main">
        <div class="acLoginBox w1000center clearfix">
            <form id="mobilereg">
                <div class="relatedLoginBox clearfix" style="width: 730px;">
                    <input type="hidden" name="Redirect_1" id="Redirect_1" value = "1"/>
                    <input type="hidden" name="Redirect_2" id="Redirect_2" value = "1"/>
                    <input type="hidden" name="Redirect_3" id="Redirect_3" value = "1"/>
                    <input type="hidden" name="Redirect_4" id="Redirect_4" value = "1"/>
                    <input type="hidden" name="Redirect_5" id="Redirect_5" value = "0"/>
                    <input type="hidden" name="Redirect_6" id="Redirect_6" value = "0"/>
                    <ul id="login_nav">
                        <li class="clearfix">
                            <em>手机：</em>
                            <input type="text" name="phones" id="mobilephone" placeholder="请填写常用手机号" tabindex="1" />
                            <span class="Exp"></span>
                        </li>
                        <li class="clearfix">
                            <em>密码：</em>
                            <input type="password" name="password" id="Password" maxlength="16" placeholder="请输入8-16位字母或数字" tabindex="2" />
                            <span class="Exp"></span>
                        </li>
                        <li class="clearfix imgyzm">
                            <em>图片验证码：</em>
                            <input type="text" id="imgvefyData" placeholder="请输入图片验证码" tabindex="3" />
                            <img src="http:/yanzheng" id="imgCode" onclick="changeImage();" style="cursor:pointer" alt="验证码" title="看不清？点击换一张" />
                            <span class="Exp yzmTipInfo"></span>
                        </li>
                        <li id="validatecode" class="clearfix">
                            <em>手机验证码：</em>
                            <input type="text" name="mobilevalidatecode" id="mbyzm" class="yzmtxt" maxlength="6" placeholder="请输入手机验证码" tabindex="4" />
                            <span id = "change_mb">
                            <input type="button" class="fsyzm" id="getvefydata_mobile" value="发送验证码" onclick="phoneSubmit();" />
                            </span>
                            <span class="Exp"></span>
                        </li>
                        
                         <li class="clearfix">
                            <em>邀请码：</em>
                            <input type="text" value = "<?php if ($invite) echo $invite;?>" name="invite" id="invite" placeholder="没有邀请码，可不填" tabindex="1"  <?php if ($invite) { echo("readonly='readonly'");}?> />
                            <span class="Exp"></span>
                        </li>
                        <li>
                            <p class="checkcorrect" style="height: 30px; line-height: 30px;">
                                <input type="checkbox" id="agree" name="agree" value="1" checked="checked" class="check" />我同意
                               <a href="/site/zhs_zhsjr/28.html" target="_blank">《服务条款》</a>
                            </p>
                            <span class="Exp" style="margin-left:74px"></span>
                        </li>
                        <li class="mb0">
                            <input type="button" id="mobireg" class="lgn" value="注 册"   onclick="reg_submit();"/>
                        </li>
                    </ul>
                </div>
            </form>
        </div>
    </div>
    
 <?php include './application/views/common/zhs_footer.php';?>
    <script src="<?php echo CON_STATIC_URL; ?>zhsjr/js/login/jquery.placeholder.min.js" type="text/javascript" charset="utf-8"></script>
    <script src="<?php echo CON_STATIC_URL; ?>zhsjr/js/login/jquery.cookie.min.js" type="text/javascript" charset="utf-8"></script>
  <script type="text/javascript" charset="utf-8">
  
	$("#mobilephone").blur(function(){
		var t=$(this);
		var u = /^(13[0-9]|14[57]|15[0-35-9]|17[0678]|18[0-9])[0-9]{8}$/;
		t.val($.trim(t.val()));
		if($.trim(t.val()).length<1){
			$(this).parent().find(".Exp").attr("class","Exp").addClass("Wrong").html("手机不能为空").show();
		}else if(!u.test($.trim(t.val()))){
			$(this).parent().find(".Exp").attr("class","Exp").addClass("Wrong").html("请输入正确的手机号码").show();
		}else{
			$.ajax({
				type: "post",
				url: "/reg/check_phone/",
				data: "phone="+$("#mobilephone").val(),
				success: function(ret){
					if(ret.exist == 1){
						$("#Redirect_1").val("1");
						t.parent().find(".Exp").attr("class","Exp").addClass("Wrong").html(ret.msg).show();
					}else{
						$("#Redirect_1").val("0");
						t.parent().find(".Exp").attr("class","Exp").addClass("Correct").html("").show();
					}
				},
				dataType: "json"
			});	
		}
	});

	$("#Password").on("blur",function(){
		var f = /^(?![^a-zA-Z]+$)(?!\D+$).{8,16}$/;
		var e=/^[^<>]{8,16}$/;
		if($.trim($("#Password").val()).length<1 ){
			$("#Redirect_2").val("1");
			$("#Password").parent().find(".Exp").attr("class","Exp").addClass("Wrong").html("密码不能为空").show();
		}else if(f.test($.trim($("#Password").val()))){
			if(e.test($.trim($("#Password").val()))){
				$("#Redirect_2").val("0");
				$("#Password").parent().find(".Exp").attr("class","Exp").addClass("Correct").html("").show() ;
			}else{
				$("#Redirect_2").val("1");
				$("#Password").parent().find(".Exp").attr("class","Exp").addClass("Wrong").html("密码为8-16位必须含有字母+数字,且不能包含<>").show();
			}
		}else{
			$("#Redirect_2").val("1");
			$("#Password").parent().find(".Exp").attr("class","Exp").addClass("Wrong").html("密码为8-16位必须含有字母+数字,且不能包含<>").show();
		}
									
	});
	
	$("#imgvefyData").blur(function(){
		var t=$(this);
		if($.trim(t.val()).length<1){
			$(this).parent().find(".Exp").addClass("Wrong").html("图片验证码不能为空").show();
		}else {
			$.ajax({
				type: "post",
				url: "/reg/check_imgvefy/",
				data: "imgvefy="+$("#imgvefyData").val(),
				success: function(ret){
					if(ret.exist == 1){
						$("#Redirect_3").val("1");
						t.parent().find(".Exp").attr("class","Exp").addClass("Wrong").html(ret.msg).show();
					}else{
						$("#Redirect_3").val("0");
						t.parent().find(".Exp").attr("class","Exp").addClass("Correct").html("").show();
					}
				},
				dataType: "json"
			});	
		}
	});

	
	$("#invite").blur(function(){
		var t=$(this);
		if($.trim(t.val()).length<1){
			t.parent().find(".Exp").attr("class","Exp").addClass("Correct").html("").show();
		}else {
			$.ajax({
				type: "post",
				url: "/reg/check_invite/",
				data: "invite="+$("#invite").val(),
				success: function(ret){
					if(ret.exist == 1){
						$("#Redirect_6").val("1");
						t.parent().find(".Exp").attr("class","Exp").addClass("Wrong").html(ret.msg).show();
					}else{
						$("#Redirect_6").val("0");
						t.parent().find(".Exp").attr("class","Exp").addClass("Correct").html("").show();
					}
				},
				dataType: "json"
			});	
		}
	});
/*
	$("#mbyzm").blur(function(){
		var t=$(this);
		if($.trim(t.val()).length<1){
			$(this).parent().find(".Exp").addClass("Wrong").html("手机验证码不能为空").show();
		}else {
			$.ajax({
				type: "post",
				url: "/reg/check_mbyzm/",
				data: "mbyzm="+$("#mbyzm").val()+"&phones="+$("#mobilephone").val(),
				success: function(ret){
					if(ret.exist == 1){
						$("#Redirect_4").val("1");
						t.parent().find(".Exp").attr("class","Exp").addClass("Wrong").html(ret.msg).show();
					}else{
						$("#Redirect_4").val("0");
						t.parent().find(".Exp").attr("class","Exp").addClass("Correct").html("").show();
					}
				},
				dataType: "json"
			});	
		}
	});
*/

	$("#agree").bind("blur click",function(){
		if(this.checked){
			$("#Redirect_5").val("0");
			$(this).parents("li").find(".Exp").attr("class","Exp").addClass("Correct").html("").hide();
		}else{
			$("#Redirect_5").val("1");
			$(this).parents("li").find(".Exp").attr("class","Exp").addClass("Wrong").html("必须同意服务条款及借入协议").show();
		}
	});
	
	function reg_submit(){
		$("#Redirect_4").val("0");
		$val_1 = $.trim($("#Redirect_1").val());
		$val_2 = $.trim($("#Redirect_2").val());
		$val_3 = $.trim($("#Redirect_3").val());
		$val_4 = $.trim($("#Redirect_4").val());
		$val_5 = $.trim($("#Redirect_5").val());
		$val_6 = $.trim($("#Redirect_6").val());
		if($val_1 == 1 || $val_2 == 1 || $val_3 == 1 || $val_4 == 1 || $val_5 == 1  || $val_6 == 1){
			alert("请先修改相关错误数据");
		}else{
			$.ajax({
				type: "post",
				url: "/reg",
				dataType: "json",
				data: "password="+$("#Password").val()+"&phones="+$("#mobilephone").val()+"&agr="+$("#agree").val()+"&act=reg"+"&invite="+$("#invite").val(),
				success: function(ret){
					if( ret.msg =='' ){
						if(ret.data.url==''){
							window.location.reload();
						}else{
							window.location=ret.data.url;
						}
					}else{
						alert(ret.msg);
						//alert("失败");
					}
				}
				
			});	
		}
	}


	function phoneSubmit(){
		var t=$("#mobilephone");
		var u = /^(13[0-9]|14[57]|15[0-35-9]|17[0678]|18[0-9])[0-9]{8}$/;
		t.val($.trim(t.val()));
		if($.trim(t.val()).length<1){
			$("#mobilephone").parent().find(".Exp").attr("class","Exp").addClass("Wrong").html("手机不能为空").show();
		}else if(!u.test($.trim(t.val()))){
			$("#mobilephone").parent().find(".Exp").attr("class","Exp").addClass("Wrong").html("请输入正确的手机号码").show();
		}else if($.trim($("#imgvefyData").val()).length<1){
			$("#imgvefyData").parent().find(".Exp").addClass("Wrong").html("图片验证码不能为空").show();
		}else{
				$.ajax({
				type: "post",
				url: "/reg/apply_phone/",
				data: "phone="+$("#mobilephone").val()+"&captcha="+$("#imgvefyData").val(),
				success: function(ret){
					if(ret.info == 1){
						alert("验证码已发送,请查收");
						//phone_countdown();
					}
				},
				dataType: "json"
			});	
		}
	}
/*
	function phone_countdown(){
		var count = 180;
		var countdown = setInterval(CountDown, 1000); 
		function CountDown() {
			$("#change_mb").html('请等待 <font style="color:#a71e32;">'+count+"</font>秒");
			if (count == 0) {
				$("#change_mb").html('<input type="button" class="fsyzm" id="getvefydata_mobile" value="发送验证码" onclick="phoneSubmit();" />');
				clearInterval(countdown);
			}
			count--;
		}
	}
*/
  </script>
</body>
</html>
